home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr22 / gnplt.zip / CONTOURS.DEM < prev    next >
Text File  |  1993-09-15  |  5KB  |  168 lines

  1. #
  2. # $Id: contours.dem%v 3.38.2.146 1993/06/30 21:24:08 woo Exp woo $
  3. #
  4. set samples 20
  5. set isosamples 21
  6. set xlabel "X axis" -5,-2
  7. set ylabel "Y axis" 4,-1
  8. set zlabel "Z axis"
  9. set title "3D gnu plot demo - contour plot"
  10. set contour
  11. splot x*y
  12. pause -1 "Hit return to continue (1)"
  13. set cntrparam levels 20
  14. set title "3D gnu plot demo - contour plot (more contours)"
  15. replot
  16. pause -1 "Hit return to continue (2)"
  17. set cntrparam levels incr -100,10,100
  18. set title "3D gnu plot demo - contour plot (every 10, starting at -100)"
  19. replot
  20. pause -1 "Hit return to continue (3)"
  21. set cntrparam levels disc -75,-50,0
  22. set title "3D gnu plot demo - contour plot (at -75, -50, 0)"
  23. replot
  24. pause -1 "Hit return to continue (4)"
  25. set cntrparam levels auto 10
  26. set title "3D gnu plot demo - contour plot on base grid"
  27. set contour base
  28. splot x**2-y**2
  29. pause -1 "Hit return to continue (5)"
  30. set title "3D gnu plot demo - contour plot on surface"
  31. set contour surface
  32. replot
  33. pause -1 "Hit return to continue (6)"
  34. set title "3D gnu plot demo - contour plot on both"
  35. set contour both
  36. replot
  37. pause -1 "Hit return to continue (7)"
  38. set contour base
  39. set title "3D gnu plot demo - 2 surfaces
  40. splot x**2*y**3, x**3*y**2
  41. pause -1 "Hit return to continue (8)"
  42. set title "3D gnu plot demo - some more interesting contours"
  43. splot x*y / (x**2 + y**2 + 0.1)
  44. pause -1 "Hit return to continue (9)"
  45. splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
  46. pause -1 "Hit return to continue (10)"
  47. set zrange [-0.5:0.5]
  48. replot
  49. pause -1 "Hit return to continue (11)"
  50. set samples 6
  51. set isosamples 6
  52. set cntrparam levels 5
  53. set title "3D gnu plot demo - low resolution (6x6)"
  54. replot
  55. pause -1 "Hit return to continue (12)"
  56. set cntrparam bspline
  57. set title "3D gnu plot demo - low resolution (6x6) using bspline approx."
  58. replot
  59. pause -1 "Hit return to continue (13)"
  60. set cntrparam order 8
  61. set title "3D gnu plot demo - low resolution (6x6) raise bspline order."
  62. replot
  63. pause -1 "Hit return to continue (14)"
  64. set cntrparam linear
  65. set auto
  66. set title "3D gnu plot demo - low resolution (6x6) using linear contours."
  67. splot x*y
  68. pause -1 "Hit return to continue (15)"
  69. set cntrparam order 4
  70. set cntrparam bspline
  71. set title "3D gnu plot demo - low resolution (6x6) using bspline approx."
  72. replot
  73. pause -1 "Hit return to continue (16)"
  74. set samples 25
  75. set isosamples 26
  76. set title "3D gnu plot demo - contour of Sinc function"
  77. splot [-5:5.01] [-5:5.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
  78. pause -1 "Hit return to continue (17)"
  79. splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
  80. pause -1 "Hit return to continue (18)"
  81. set cntrparam levels 10
  82. set xrange [0:15]
  83. set yrange [0:15]
  84. set auto
  85. set zrange [-0.6:0.6]
  86. set data style lines
  87. set title "3D gnu plot demo - contour of data grid plotting"
  88. set parametric
  89. splot "glass.dat"
  90. pause -1 "Hit return to continue (19)"
  91. set zrange [-1.2:1.2]
  92. set noparametric
  93. splot "glass.dat" using 1
  94. pause -1 "Hit return to continue (20)"
  95. set view 0,0,1
  96. set nosurface
  97. set title "3D gnu plot demo - 2D contour projection of last plot"
  98. replot
  99. pause -1 "Hit return to continue (21)"
  100.  
  101. #From: shen@athena.cs.uga.edu (Mingzuo Shen)
  102. #Subject: Rosenbrock's function: some answers and thanks
  103. #Date: Wed, 23 Jun 1993 20:50:36 GMT
  104. #
  105. #    Last night I asked for help with a contour plot for the function:
  106. #
  107. #    (1-x)**2 + 100 * (y - x**2)**2
  108. #
  109. #which should have a minimum at (x=1,y=1). This is the 2D case of a more
  110. #general function named after Rosenbrock (the book I am reading does not
  111. #give a reference to any paper/book by this person):
  112. #
  113. #    for even integer n,
  114. #
  115. #    f(x) = \sum_{j=1,3,5,\ldots,n} [(1 - x_j)^2 + 100(x_{j+1} - x_j^2)^2]
  116. #
  117. #where x is a vector (x1, x2, ..., x_n). This function also have a minimum
  118. #at (1,1,...,1), which lies at the base of a "banana-shaped valley".
  119. #Here are the new commands I have tried.
  120. #
  121. set auto
  122. set surface
  123. set nocontour
  124. set cntrparam levels 5
  125. set cntrparam linear
  126. set samples 100
  127. set logscale z
  128. set hidden3d
  129. set isosamples 20
  130. set view 70,335,1
  131. set xlabel "x"
  132. set ylabel "y"
  133. set title "Rosenbrock Function"
  134. splot [0.9:1.1] [0.9:1.1] (1-x)**2 + 100*(y - x**2)**2
  135. pause -1 "Hit Return to Continue (22)"
  136.  
  137. set logscale z
  138. set hidden3d
  139. set isosamples 60
  140. set view 20,340,1,2
  141. set xlabel "x"
  142. set ylabel "y"
  143. splot [-1.5:1.5] [-0.5:1.5] (1-x)**2 + 100*(y - x**2)**2
  144. pause -1 "Hit Return to Continue (23)"
  145. set contour
  146. set nosurface
  147. replot
  148. pause -1 "Hit Return to Continue (24)"
  149. #
  150. # Clean up:
  151. #
  152. set nolog
  153. set surface
  154. set nocontour
  155. set cntrparam levels 5
  156. set cntrparam linear
  157. set samples 100
  158. set isosamples 10
  159. set view 60,30,1,1
  160. set xrange [-10:10]
  161. set yrange [-10:10]
  162. set zrange [-10:10]
  163. set auto
  164. set title "" 0,0
  165. set xlabel "" 0,0
  166. set ylabel "" 0,0
  167. set zlabel "" 0,0
  168.